# Maintainer: Cowington Post <cowingtonpost@gmail.com>
pkgname=yarr
pkgver=2.4
pkgrel=5
pkgdesc="Yarr is a web-based feed aggregator which can be used both as a desktop application and a personal self-hosted server"
url="https://github.com/nkanaev/yarr/"
# fails tests on 32-bit
arch="all !x86 !armhf !armv7"
license="MIT"
makedepends="go sqlite-dev"
install="$pkgname.pre-install"
subpackages="$pkgname-doc $pkgname-openrc"
source="https://github.com/nkanaev/yarr/archive/refs/tags/v$pkgver/yarr-$pkgver.tar.gz
	yarr.initd
	yarr.confd
	"

build() {
	go build -tags "sqlite_foreign_keys libsqlite3 release" -ldflags="-X 'main.Version=$pkgver'" -o yarr src/main.go
}

check() {
	cd src
	go test -tags "sqlite_foreign_keys libsqlite3 release" ./...

}

package() {
	install -m755 -D yarr "$pkgdir"/usr/bin/"$pkgname"

	install -m755 -D "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname
	install -m644 -D "$srcdir"/$pkgname.confd \
		"$pkgdir"/etc/conf.d/$pkgname

	mkdir -p "$pkgdir"/usr/share/doc/"$pkgname"
	cp -a doc "$pkgdir"/usr/share/doc/"$pkgname"
}

sha512sums="
8a45012453db6ff5df3256b5bdf384fe426fb5ca408d9167669f28c7d948c3d94c7fc4b796d08b1d45c74e0df9e96b14ef16a0fa2a320d87510b49f92ccae849  yarr-2.4.tar.gz
9373b444bd679b98b429fe935e6c397057cc834db477f3c2e1d75b07a8e5a8634de2a2159fa9157c479d1d1856cfa770e73328e58ce07ba2cb92d7ab7f1fe827  yarr.initd
e2858394556bf6497969354c2a2c0514c334e3d745d0425fc606b44fdc68013a25df093160b6d6fcbec8e98ee623a3add0e51d8d9664397e27dc36f33d965be4  yarr.confd
"
